<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:th="http://www.thymeleaf.org" lang="en">

<head th:replace="fragments/headTag :: headTag">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>QuDEx Repository Tools - Collections Manager</title>

<!-- Bootstrap -->
<link
	href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.css"
	th:href="@{/webjars/bootstrap/3.0.3/css/bootstrap.css}"
	rel="stylesheet" />
<link href="../../../resources/css/navbar.css"
	th:href="@{/resources/css/navbar.css}" rel="stylesheet" />
<!-- JQuery -->
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"
	th:src="@{/webjars/jquery/1.9.0/jquery.min.js}"></script>
<script
	src="http://netdna.bootstrapcdn.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"
	th:src="@{/webjars/bootstrap/3.0.3/js/bootstrap.min.js}"></script>

<!-- Spring JS and Ajax -->
<script type="text/javascript" th:src="@{/resources/dojo/dojo.js}"></script>
<script type="text/javascript" th:src="@{/resources/spring/Spring.js}"></script>
<script type="text/javascript"
	th:src="@{/resources/spring/Spring-Dojo.js}"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
</head>
<body>
	<div class="container">
		<div th:include="fragments/bodyHeader :: bodyHeader" th:remove="tag">This
			is the navigation bar here</div>
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 th:text="#{updateResults.title}" class="panel-title">Collection-level
					spreadsheet upload results</h3>
			</div>
			<div class="panel-body">
				<p th:text="#{updateResults.text}">Find below the relevant
					information associated with the operations performed.</p>
				<div class="alert alert-info">
					<h4 th:text="#{updateResults.subtitle}">Operation results</h4>
					<p th:each="res : ${results}" th:utext="${res.getIngestionStatus()}">the
						loading results</p>
				</div>
				<form id="sendEmail" method="post" th:action="${flowExecutionUrl}"
					class="form-horizontal">
					<fieldset>
						<legend th:text="#{updateResults.subtitle2}">Email</legend>
						<p th:text="#{updateResults.text2}">You can receive an email
							with the operations results and the spreadsheet used to create
							this collection(s).</p>
						<div id="email-group" class="form-group">
							<label th:unless="${flowRequestContext.messageContext.hasErrorMessages()}" class="col-md-4 control-label" for="emailInput"></label>
							<label th:if="${flowRequestContext.messageContext.hasErrorMessages()}" class="col-md-4 control-label" for="emailInput">
								<font
									th:each="message : ${flowRequestContext.messageContext.getMessagesBySource('filesModel.emailAddress')}"
									th:text="${message.text}" color="red">the error message</font>
							</label>
							<div class="col-md-4">
								<div id="emailInput" class="input-group">
									<span class="input-group-addon label-primary"
										style="color: #ffffff;">@</span> <input
										th:field="${filesModel.emailAddress}" type="text"
										class="form-control" placeholder="email" />
								</div>
							</div>
						</div>
						<div id="email-button" class="form-group">
							<label class="col-md-4 control-label" for="addFileBtn"></label>
							<div class="col-md-4">
								<div class="input-group">
									<input id="addFileBtn" class="btn btn-primary"
										name="_eventId_sendEmail" type="submit"
										th:value="#{updateResults.send}"
										value="Send email with results" />
								</div>
							</div>
						</div>
					</fieldset>
				</form>

				<p th:if="${emailResults}" th:text="${emailResults}">the email
					send results</p>
				<br /> <a class="btn btn-primary"
					th:text="#{updateResults.submit.cancel}"
					th:href="@{'~' + ${flowExecutionUrl}(_eventId=intro)}">Restart
					the process</a> <a class="btn btn-primary"
					th:text="#{updateResults.submit.back}"
					th:href="@{'~' + ${flowExecutionUrl}(_eventId=collection)}">Update
					more collections</a>
			</div>
			<!-- Main div ends -->
			<div class="modal js-loading-bar">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-body">
							<h4 th:text="#{email.progressTitle}">Send Email</h4>
							<div class="progress progress-striped active">
								<div class="progress-bar progress-bar-info"
									th:role="progressbar" th:aria-valuenow="100"
									th:aria-valuemin="0" th:aria-valuemax="100"
									style="width: 100%;"></div>
							</div>
							<span id="pbtext" class="hide" th:text="#{email.pbMessage}">Sending
								email...</span>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div id="footer" th:include="fragments/footer :: footer"></div>
	</div>
	<script>
		$(document)
				.ready(
						function() {
							/*Tooltips*/
							$('[data-toggle="tooltip"]').tooltip({
								'placement' : 'top'
							});

							$('[data-toggle="popover"]').popover({
								trigger : 'hover',
								'placement' : 'top'
							});

							$('.js-loading-bar').modal({
								backdrop : 'static',
								show : false
							});

							$('#addFileBtn')
									.click(
											function() {
												var $modal = $('.js-loading-bar'), $bar = $modal
														.find('.progress-bar');
												$modal.modal('show');
												$bar.text($('#pbtext').text());
												$bar.addClass('animate');
											});
						});
	</script>
</body>
</html>